package com.ruicar.afs.cloud.apply.common.feign;

import com.alibaba.fastjson.JSONObject;
import com.ruicar.afs.cloud.apply.channel.condition.AffiliationCondition;
import com.ruicar.afs.cloud.apply.channel.condition.ChannelBaseInfoCondition;
import com.ruicar.afs.cloud.apply.channel.condition.CommonCarDealerCondition;
import com.ruicar.afs.cloud.apply.common.condition.DrawerCondition;
import com.ruicar.afs.cloud.apply.common.dto.ChannelAffiliatedUnitsDto;
import com.ruicar.afs.cloud.apply.common.dto.ChannelInfoDTO;
import com.ruicar.afs.cloud.apply.common.entity.WitnessInfo;
import com.ruicar.afs.cloud.apply.contract.condition.ChannelCondition;
import com.ruicar.afs.cloud.apply.contract.condition.ContractModelCondition;
import com.ruicar.afs.cloud.common.core.util.IResponse;
import com.ruicar.afs.cloud.parameter.commom.condition.VehicleCondition;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @description: 请求案件服务的渠道信息
 * @author: sijun.yu
 * @date: 2020/6/4 9:10
 */
@FeignClient(name = "Apply2ChannelFeign", url = "${com.greatwall.services.case-service.url}")
public interface Apply2ChannelFeign {

    /**
     * 查询车商列表
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("查询车商列表")
    @GetMapping(value = "/carDealer/CarDealListForZY")
    IResponse getCarDealList(@SpringQueryMap ChannelInfoDTO dto, @RequestHeader Map<String, String> headers);

    /**
     * 查询挂靠公司列表
     *
     * @param dto
     * @return
     */
    @ApiOperation("查询挂靠公司列表")
    @GetMapping(value = "/caseChannel/getAffiliationInfo")
    IResponse getAffiliatedUnitsList(@SpringQueryMap ChannelInfoDTO dto, @RequestHeader Map<String, String> headers);

    /**
     * 查询网约车平台列表
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("查询网约车平台列表")
    @GetMapping(value = "/caseChannel/getCooperPlatList")
    IResponse getCooperPlatList(@SpringQueryMap ChannelInfoDTO dto, @RequestHeader Map<String, String> headers);

    /**
     * 同步案件数据
     *
     * @param statusCondition
     * @param headers
     * @return
     */
    @PostMapping(value = "/caseChannel/getBaseInfo")
    @ApiOperation("同步案件数据")
    public IResponse getBaseInfo(@RequestBody ChannelBaseInfoCondition statusCondition, @RequestHeader Map<String, String> headers);

    /**
     * 合作商详情
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("合作商详情")
    @PostMapping(value = "/channelCaseInfo/channelInfoForUserName")
    public JSONObject getChannelDetailInfo(@RequestBody ChannelInfoDTO dto, @RequestHeader Map<String, String> headers);

    /**
     * 批量修改业务员
     *
     * @param salesman
     * @param ids
     * @param channelId
     * @param requestHeader
     * @return
     */
    @GetMapping("/carDealer/bulkEditingSalesmanFromApply/{salesman}/{ids}/{channelId}")
    @ApiOperation(value = "批量修改业务员")
    IResponse bulkEditingSalesman(@PathVariable(value = "salesman") String salesman, @PathVariable(value = "ids") String[] ids, @PathVariable(value = "channelId") String channelId, @RequestHeader Map<String, String> requestHeader);

    /**
     * 从进件端停用案件端普通车商
     *
     * @param ids
     * @param channelId
     * @param requestHeader
     * @return
     */
    @GetMapping("/carDealer/disableCarDealerFromCase/{ids}/{channelId}")
    @ApiOperation(value = "从进件端停用案件端普通车商")
    IResponse disableCarDealerFromCase(@PathVariable(value = "ids") String[] ids, @PathVariable(value = "channelId") String channelId, @RequestHeader Map<String, String> requestHeader);

    /**
     * 增加普通车商到案件服务
     *
     * @param condition
     * @param requestHeader
     * @return
     */
    @PostMapping("/carDealer/addCarDealer")
    @ApiOperation(value = "增加普通车商到案件服务")
    IResponse addCarDealerToCase(@RequestBody CommonCarDealerCondition condition, @RequestHeader Map<String, String> requestHeader);

    /**
     * 直营车商的接口
     */
    @GetMapping("/carDealer/disableDirectCarDealerFromApply/{ids}/{channelId}")
    @ApiOperation(value = "禁用进件端直营车商")
    IResponse disableDirectCarDealerFromApply(@PathVariable(value = "ids") String[] ids, @PathVariable(value = "channelId") String channelId, @RequestHeader Map<String, String> requestHeader);

    /**
     * 批量修改进件端直营车商城市经理
     *
     * @param customerManager
     * @param channelId
     * @param ids
     * @param type
     * @param requestHeader
     * @return
     */
    @GetMapping("/carDealer/bulkEditingCustomerManagerFromApply/{customerManager}/{channelId}/{ids}/{type}")
    @ApiOperation(value = "批量修改进件端直营车商城市经理")
    IResponse bulkEditingCustomerManagerFromApply(@PathVariable(value = "customerManager") String customerManager, @PathVariable(value = "channelId") String channelId, @PathVariable(value = "ids") String[] ids, @PathVariable(value = "type") String type, @RequestHeader Map<String, String> requestHeader);

    /**
     * 合作商详情
     *
     * @param channelCondition
     * @param headers
     * @return
     */
    @ApiOperation("合作商详情")
    @PostMapping(value = "/channelCaseInfo/channelInfoForUserName")
    public IResponse getChannelBaseInfo(@RequestBody ChannelCondition channelCondition, @RequestHeader Map<String, String> headers);

    /**
     * 获取见证人id
     *
     * @param witnessInfo
     * @param headers
     * @return
     */
    @ApiOperation("获取见证人id")
    @PostMapping(value = "/witness/getWitnessByChannelId")
    public JSONObject getWitnessByChannelId(@RequestBody WitnessInfo witnessInfo, @RequestHeader Map<String, String> headers);

    /**
     * 获取业务类型
     *
     * @param dto
     * @param headers
     * @return
     */
    @ApiOperation("获取业务类型")
    @PostMapping(value = "/channelCaseInfo/queryCarType")
    public JSONObject queryCarType(@RequestBody ChannelInfoDTO dto, @RequestHeader Map<String, String> headers);

    /**
     * 获取挂靠次数
     *
     * @param channel
     * @param headers
     * @return
     */
    @ApiOperation("获取挂靠次数")
    @PostMapping(value = "/caseChannel/affiliatedCount")
    public JSONObject affiliatedCount(@RequestBody AffiliationCondition channel, @RequestHeader Map<String, String> headers);

    /**
     * 通过渠道id返回渠道和车商列表
     * @param dto
     * @param headers
     * @return
     */
    @PostMapping(value = "/carDealer/getCarDealerByChannelId")
    public IResponse getCarDealerByChannelId(@RequestBody ChannelInfoDTO dto, @RequestHeader Map<String, String> headers);

    /**
     * 通过渠道id获取保证金信息
     * @param dto
     * @param headers
     * @return
     */
    @PostMapping(value = "/channelQuota/getQuotaListByChannelId")
    public IResponse getQuotaListByChannelId(@RequestBody ChannelInfoDTO dto, @RequestHeader Map<String, String> headers);
    /**
     * 通过条件查询开票单位列表
     * @param dto
     * @param headers
     * @return
     */
    @PostMapping(value = "/drawerParty/getdrawerPartyByChannelId")
    public IResponse getdrawerPartyByChannelId(@RequestBody DrawerCondition dto, @RequestHeader Map<String, String> headers);

    /**
     * id获取挂靠信息
     * */
    @PostMapping(value = "/caseChannel/getAffiliatedById")
    @ApiOperation("根据id获取挂靠信息")
    public ChannelAffiliatedUnitsDto getAffiliatedById(@RequestBody JSONObject condition, @RequestHeader Map<String, String> headers);

    /**
     * 查询品牌列表
     * @param condition
     * @param headers
     * @return
     */
    @PostMapping(value = "/caseVehicle/getBrandList")
    @ApiOperation("查询品牌列表")
    IResponse<JSONObject> getBrandList(@RequestBody VehicleCondition condition, @RequestHeader Map<String, String> headers);

    /**
     * 查询车型列表
     * @param condition
     * @param headers
     * @return
     */
    @PostMapping(value = "/caseVehicle/getModelList")
    @ApiOperation("查询车型列表")
    IResponse<JSONObject> getModelList(@RequestBody VehicleCondition condition, @RequestHeader Map<String, String> headers);

    /**
     * 查询车型列表 - 模糊查询
     * @param condition
     * @param headers
     * @return
     */
    @PostMapping(value = "/caseVehicle/getModeTitleList")
    @ApiOperation("查询车型列表 - 模糊查询")
    IResponse<JSONObject> getModelTitleList(@RequestBody VehicleCondition condition, @RequestHeader Map<String, String> headers);

    /**
     * 判断是否首单
     */
    @PostMapping(value = "/loanApprove/getIsFirstMortgage")
    @ApiOperation("判断是否首单")
    public IResponse getIsFirstMortgage(@RequestBody ContractModelCondition contractModelCondition, @RequestHeader Map<String, String> headers);

    /**
     * 获取车商省份和城市
     * @param headers
     * @return
     */
    @PostMapping(value = "/carDealer/getAuthorizeRegion")
    @ApiOperation("获取车商省份和城市")
    IResponse getAuthorizeRegion(@RequestBody ChannelInfoDTO dto, @RequestHeader Map<String, String> headers);

}
